package easy;

/**
 * @author admin
 * 344. 反转字符串
 * 解题思路：双指针，初始化一个左指针和右指针，但左指针小于右指针时，交换左右字符
 */
public class LeeCode344 {

    public void reverseString(char[] s) {
        int left = 0;
        int right = s.length - 1;
        char temp = ' ';
        while( left < right){
            temp = s[left];
            s[left] = s[right];
            s[right] = temp;
            left++;
            right--;
        }
    }

    public static void main(String[] args) {
        new LeeCode344().reverseString(new char[]{'h','e','l','l','o'});
    }
}
